|
|
@@ -165,5 +165,18 @@ describe LiquidInterpolatable::Filters do
|
165
|
165
|
expect(@agent.interpolated['long_url']).to eq('http://2many.x/6')
|
166
|
166
|
end
|
167
|
167
|
end
|
|
168
|
+
|
|
169
|
+ describe 'regex_replace' do
|
|
170
|
+ it 'should replace all occurences of a string using regex' do
|
|
171
|
+ expect(@filter.regex_replace('foobar foobar', /\S+bar/, 'foobaz')).to eq('foobaz foobaz')
|
|
172
|
+ end
|
|
173
|
+ end
|
|
174
|
+
|
|
175
|
+ describe 'regex_replace_first' do
|
|
176
|
+ it 'should replace the first occurences of a string using regex' do
|
|
177
|
+ expect(@filter.regex_replace_first('foobar foobar', /\S+bar/, 'foobaz')).to eq('foobaz foobar')
|
|
178
|
+ end
|
|
179
|
+ end
|
|
180
|
+
|
168
|
181
|
end
|
169
|
182
|
end
|